<?php

function smarty_function_widget($params, $smarty)
{
    $name = $params['class'];
	$namespace = $params['namespace'];

	if (!empty($namespace)) {
		using($namespace);
	}
    $widget = new $name();
    $widget->init($params);

    if ($params['assign']) {
        $this->assign($params['assign'],$widget);
    }
    else {
        return $widget->display();
    }
}